﻿using System;

using RpcClient.Interface;

namespace RpcModular.Config
{
        public class IdentityConfig
        {
                public static event Action RefreshEvent;

                static IdentityConfig()
                {
                        RpcClient.RpcClient.Config.AddRefreshEvent(_Refresh);
                }

                private static void _Refresh(IConfigServer server, string name)
                {
                        if (RefreshEvent == null)
                        {
                                return;
                        }
                        else if (name == string.Empty || name.StartsWith("rpcassembly:identity"))
                        {
                                RefreshEvent();
                        }
                }

                /// <summary>
                /// 是否启用
                /// </summary>
                public bool IsEnable
                {
                        get;
                        private set;
                }
                /// <summary>
                /// 默认应用Id
                /// </summary>
                public string DefAppId
                {
                        get;
                        private set;
                }
        }
}
